Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc_typeck: remove the "preload all impls ever" workaround in coherence. #25323

Merged
merged 4 commits into from
May 12, 2015

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented May 12, 2015

The loop to load all the known impls from external crates seems to have been used because ty::populate_implementations_for_trait_if_necessary wasn't doing its job, and solely relying on it resulted in loading only impls in the same crate as the trait.

Coherence for librustc was reduced from 18.310s to 0.610s, from stage1 to stage2.
Interestingly, type checking also went from 46.232s to 42.003s, though that could be noise or unrelated improvements.

On a smaller scale, fn main() {} now spends 0.003s in coherence instead of 0.368s, which fixes #22068.
It also peaks at only 1.2MB, instead of 16MB of heap usage.

@rust-highfive
Copy link
Collaborator

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

@eddyb
Copy link
Member Author

eddyb commented May 12, 2015

@brson Any chance this can make it into 1.0? I don't mind it personally, but I've seen some interest on IRC for having the (minor IMO) compile-time wins here in 1.0.

@bstrie
Copy link
Contributor

bstrie commented May 12, 2015

@eddyb, you're my hero 😻

@pnkfelix
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented May 12, 2015

📌 Commit 75cd8f9 has been approved by pnkfelix

@pnkfelix
Copy link
Member

@bors p=5

@pnkfelix
Copy link
Member

(Regarding 1.0, I'm inclined to say the risk/reward here does not pay off; there are other lower risk PR's that also have UX impact that we declined much earlier in beta cycle)

@pnkfelix
Copy link
Member

Cc @nikomatsakis

@bors
Copy link
Contributor

bors commented May 12, 2015

⌛ Testing commit 75cd8f9 with merge 67dfc17...

bors added a commit that referenced this pull request May 12, 2015
The loop to load all the known impls from external crates seems to have been used because `ty::populate_implementations_for_trait_if_necessary` wasn't doing its job, and solely relying on it resulted in loading only impls in the same crate as the trait.

Coherence for `librustc` was reduced from 18.310s to 0.610s, from stage1 to stage2.
Interestingly, type checking also went from 46.232s to 42.003s, though that could be noise or unrelated improvements.

On a smaller scale, `fn main() {}` now spends 0.003s in coherence instead of 0.368s, which fixes #22068.
It also peaks at only 1.2MB, instead of 16MB of heap usage.
@nikomatsakis
Copy link
Contributor

Without reading too closely, this looks great to me, and I agree with @pnkfelix's assessment that this is not a good candidate for backporting.

@bors bors merged commit 75cd8f9 into rust-lang:master May 12, 2015
@eddyb eddyb deleted the coherent-coherence branch May 12, 2015 12:23
@killercup
Copy link
Member

Nice, those are some serious speedups! Looks like 1.1 will already improve compile speed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiling hello world on RPi spends 4 seconds in coherence checking
8 participants